<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-calendar"></i>系统设置
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <el-form ref="form" label-width="120px">
        <el-form-item label="LED灯开启时间">
          <el-input type="text" v-model="config.ledstime"></el-input>
        </el-form-item>
        <el-form-item label="LED灯关闭时间">
          <el-input type="text" v-model="config.ledetime"></el-input>
        </el-form-item>

        <el-button type="primary" @click="save">保存</el-button>
      </el-form>
    </div>
  </div>
</template>

<script>
import VueCropper from "vue-cropperjs";
export default {
  name: "upload",
  data: function() {
    return {
      defaultSrc: require("../../../assets/img/img.png"),
      fileList: [],
      imgSrc: "",
      cropImg: "",
      dialogVisible: false,
      config: {
        newpass1: "",
        newpass2: ""
      }
    };
  },
  components: {
    VueCropper
  },
  methods: {
    save: function() {
      if (this.config.newpass1 == "") {
        this.$message.warning("请输入新密码");
      } else if (this.config.newpass2 == "") {
        this.$message.warning("请重复输入密码");
      } else if (this.config.newpass1 != this.config.newpass2) {
        this.$message.warning("两次输入的密码不一致");
      } else {
        var userid = JSON.parse(localStorage.getItem("myuser")).id;
        this.config.userid = userid;
        this.$axios
          .post(this.$api + "admin/updatepass", this.config)
          .then(res => {
            if (res.data.status == 200) {
              var deviceinfo = res.data.data;
              this.$message.success(res.data.message);
            } else {
              this.$message.error(res.data.message);
            }
          });
      }
    }
  },
  created() {}
};
</script>

<style scoped>
.content-title {
  font-weight: 400;
  line-height: 50px;
  margin: 10px 0;
  font-size: 22px;
  color: #1f2f3d;
}
.pre-img {
  width: 100px;
  height: 100px;
  background: #f8f8f8;
  border: 1px solid #eee;
  border-radius: 5px;
}
.crop-demo {
  display: flex;
  align-items: flex-end;
}
.crop-demo-btn {
  position: relative;
  width: 100px;
  height: 40px;
  line-height: 40px;
  padding: 0 20px;
  margin-left: 30px;
  background-color: #409eff;
  color: #fff;
  font-size: 14px;
  border-radius: 4px;
  box-sizing: border-box;
}
.crop-input {
  position: absolute;
  width: 100px;
  height: 40px;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
}
</style>